<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>Volontari</title>
              
        <script type="text/javascript" src="../Scripts/jquery-1.9.0.js"></script>  
             
        <link rel="stylesheet" type="text/css" href="../Style/siteStyle.css">
        <link rel="stylesheet" type="text/css" href="../Style/pluginStyle.css"> 
        
        <?php
            include '../config.php';
            include '../db/volontariCani.php';
        ?>
        <?php
        	
        	$volontari = new volontariCani();
        	if(isset($_REQUEST['Cancella']))
            {
                 $idVolontario=$_REQUEST['Cancella'];                 
                 $volontari->deleteVolontario($idVolontario);    
                                              
            }
        ?> 
    </head> 
    <body>
        <div class="container">
            <!-- header -->
            <?php include '../Sections/header.html'; ?>
            <div>
                <!-- menu di sinistra -->
                <?php include '../Sections/leftMenu.html'; ?>
                <!-- contenuto -->
                <div class="mainContent">
                    <h2>Lista volontari</h2>
                    <div class="list">                   
                          <form>
	                        <table cellspacing="0" cellpadding="4px">
	                            <tr>
	                                <th>Volontario</th>
	                                <th>Sezione</th>
	                                <th>Cinofilo</th>
	                                <th>Numero di telefono</th>
	                                <th>Cellulare</th>
	                                <th>Modifica</th>
	                                <th>Elimina</th>                                
	                            </tr>
	                        <?php
	                    $result = $volontari->getVolontari();
	                    while ($row = mysql_fetch_assoc($result)) {
	                        ?>
	                            <tr>                                
	                                <td>
	                                    <a href="DettagliVolontario.php?id_vol=<?php echo $row['IDVolontario']; ?>" class="tableLink">   
	                                        <?php echo $row['Cognome']." ".$row['Nome']; ?>
	                                    </a>
	                                </td>
	                                <td>
	                                    <?php echo $row['Sezione']; ?>
	                                </td>
	                                <td style="text-align: center">
	                                    <?php if ($row['Cinofilo']==1) {?>
	                                    <img src="../Style/Images/tick-icon_16.png">
	                                    <?php } ?>
	                                </td>
	                                <td>
	                                    <?php echo $row['Telefono']; ?>
	                                </td>
	                                 <td>
	                                    <?php echo $row['Cellulare']; ?>
	                                </td>
	                                <td style="text-align: center">
	                                    <button type="button" name="Modifica" 
	                                    title="Modifica dati volontario"
	                                    value="<?php echo $row['IDVolontario']; ?>" 
	                                    onclick="window.location.href = 'DatiVolontario.php?id_vol=<?php echo $row['IDVolontario']; ?>'">  
	                                        <img src="../Style/Images/modify_20.png" alt="Elimina"/>    
	                                    </button>
	                                </td>
	                                <td style="text-align: center">
	                                    <button type="submit" name="Cancella" 
	                                    title="Elimina dati volontario"
	                                    value="<?php echo $row['IDVolontario']; ?>" 
	                                    onclick="return confirm('Sei sicuro di voler rimuovere <?php echo $row['Cognome']." ".$row['Nome']; ?>');">  
	                                        <img src="../Style/Images/delete_20.png" alt="Elimina"/>    
	                                    </button>
	                                </td>
	                                
	                            </tr>
	                               
	                <?php
	                    }
	
	                    ?> 
	                    
	                        </table> 	         
	                        </form>                                       
                    </div>
                </div>
                <div style="clear:both"></div>
                
                
            </div>
        </div>
        
    </body>
</html>
